export default {
    state: {
        // 控制菜单的展开还是收起
        isCollapse: false,
        // 面包屑的数据
        tabList: [
            {
                path: "/",
                name: "home",
                label: "首页",
                icon: "s-home",
                url: "Home/Home"
            },
        ]
    },
    mutations: {
        collapseMenu(state) {
            state.isCollapse = !state.isCollapse
            console.log(state.isCollapse);
        },
        //修改更新面包屑数据
        selectMenu(state, value) {
            console.log(value);
            // 判断添加的数据是否为首页
            if (value.name !== 'home') {
                const index = state.tabList.findIndex(item => item.name === value.name)
                // 不存在时
                if (index === -1) {
                    state.tabList.push(value)
                }
            }
        },
        // 删除指定的数据
        closeTag(state, item) {
            console.log(item);
            const index = state.tabList.findIndex(val => val.name === item.name)
            state.tabList.splice(index, 1)
        }

    }
}